<html>
<head>
<meta charset="UTF-8">
<title>商家信息管理</title>
<link href="./css/merchant.css" rel="stylesheet" type="text/css" />
<script language="JavaScript"
	src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<script language="JavaScript" src="./js/bootstrap.js"></script>

	<script src="client_modules/angular/angular.js"></script>
	<script src="client_modules/ng-file-upload-shim/ng-file-upload.js"></script>
	<script src="client_modules/ng-file-upload/ng-file-upload.js"></script>

<link rel="stylesheet" type="text/css" href="./css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="./css/add_dish.css" />

<link rel="stylesheet" type="text/css" href="./css/normalize.css" />
<link rel="stylesheet" type="text/css" href="./css/demo.css" />
<link rel="stylesheet" type="text/css" href="./css/icons.css" />
<link rel="stylesheet" type="text/css" href="./css/component.css" />
<link rel="stylesheet" type="text/css" href="./css/head.css" />


</head>
<body ng-app="mainApp" ng-controller="alterMerchant">
	<ul id="nav" class="hul">
		<img src="http://10.222.232.168:83/img/logo.png" />
		<li class="logout"><a href="merchant">注销</a></li>
		<li class="logout"><a href="orderManager.html" id="newMsg"></p></a></li>
	</ul>

	<div id="st-container" class="st-container">
		<nav class="st-menu st-effect-1" id="menu-1">
			<h2 class="icon icon-lab">商家</h2>
			<ul>
				<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
				<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
				<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
				<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
			</ul>
		</nav>

		<nav class="st-menu st-effect-2" id="menu-2">
			<h2 class="icon icon-lab">商家</h2>
			<ul>
				<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
				<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
				<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
				<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
			</ul>
		</nav>

		<nav class="st-menu st-effect-4" id="menu-4">
			<h2 class="icon icon-lab">商家</h2>
			<ul>
				<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
				<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
				<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
				<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
			</ul>
		</nav>

		<nav class="st-menu st-effect-5" id="menu-5">
			<h2 class="icon icon-lab">商家</h2>
			<ul>
				<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
				<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
				<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
				<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
			</ul>
		</nav>

		<nav class="st-menu st-effect-9" id="menu-9">
			<h2 class="icon icon-lab">商家</h2>
			<ul>
				<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
				<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
				<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
				<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
			</ul>
		</nav>

		<nav class="st-menu st-effect-10" id="menu-10">
			<h2 class="icon icon-lab">商家</h2>
			<ul>
				<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
				<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
				<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
				<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
			</ul>
		</nav>

		<nav class="st-menu st-effect-11" id="menu-11">
			<h2 class="icon icon-lab">商家</h2>
			<ul>
				<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
				<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
				<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
				<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
			</ul>
		</nav>

		<nav class="st-menu st-effect-12" id="menu-12">
			<h2 class="icon icon-lab">商家</h2>
			<ul>
				<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
				<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
				<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
				<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
			</ul>
		</nav>

		<nav class="st-menu st-effect-13" id="menu-13">
			<h2 class="icon icon-lab">商家</h2>
			<ul>
				<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
				<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
				<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
				<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
			</ul>
		</nav>


		<div class="st-pusher">
			<nav class="st-menu st-effect-3" id="menu-3">
				<h2 class="icon icon-lab">商家</h2>
				<ul>
					<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
					<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
					<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
					<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
				</ul>
			</nav>

			<nav class="st-menu st-effect-6" id="menu-6">
				<h2 class="icon icon-lab">商家</h2>
				<ul>
					<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
					<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
					<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
					<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
				</ul>
			</nav>

			<nav class="st-menu st-effect-7" id="menu-7">
				<h2 class="icon icon-lab">商家</h2>
				<ul>
					<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
					<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
					<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
					<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
				</ul>
			</nav>

			<nav class="st-menu st-effect-8" id="menu-8">
				<h2 class="icon icon-lab">商家</h2>
				<ul>
					<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
					<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
					<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
					<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
				</ul>
			</nav>

			<nav class="st-menu st-effect-14" id="menu-14">
				<h2 class="icon icon-lab">商家</h2>
				<ul>
					<li><a class="icon icon-data" href="dishManager.html">菜单管理</a></li>
					<li><a class="icon icon-study" href="orderManager.html">订单管理</a></li>
					<li><a class="icon icon-wallet" href="historyOrder.html">历史订单</a></li>
					<li><a class="icon icon-phone" href="merchentMsg.html">商家信息</a></li>
				</ul>
			</nav>
			<div class="st-content">
				<div class="st-content-inner">

					<div class="main clearfix">
						<div id="st-trigger-effects" class="column">

							<button data-effect="st-effect-8">商家管理</button>

						</div>
						<div class="dish">

							<form  class="bootstrap-frm">
								<table>
									<tr>
										<td><label>用户名</label></td>
										<td >{{m.account}}</td>
									</tr>
									<tr>
										<td><label>店名</label></td>
										<td><input type="text" ng-model="m.shopName"></td>
									</tr>
									<tr>
										<td><label>图标</label></td>
										<td><input type="file" ngf-select="uploadFiles($file,$invalidFiles)" accept="image/*" ngf-max-height="1000" ngf-max-size="1MB" />上传图片</td>
									</tr>
									<tr>
										<td><label>地址</label></td>
										<td><input type="text" ng-model="m.address"></td>
									</tr>
									</tr>
									<tr>
										<td><label >评分</label></td>
										<td >{{m.star}}</td>
									</tr>
									<tr>
										<td colspan="2"><input type="submit" ng-click="alert()"
											value="更改信息" class="button" class="btn btn-default btn-lg" data-toggle="modal" data-target="#myModal" style="color: #388a5a"></td>
									</tr>
								</table>
							</form>

						</div>
					</div>

				</div>

			</div>

		</div>
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
						</button>
						<h4 class="modal-title" id="myModalLabel" style="text-align: left" >
						修改结果
						</h4>
					</div>
					<div class="modal-body" align="center"><h2>{{result}}</h2></div>

					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">
							关闭
						</button>
					</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal-dialog -->
		</div><!-- /.modal -->
		<script>
			$(function () {
				$('#myModal').modal('hide')});
		</script>
	</div>
	<script src="./js/classie.js"></script>
	<script src="./js/sidebarEffects.js"></script>

</body>

<!--<script type="text/javascript">-->
	<!--window.onload=function(){-->

		<!--$.ajax("findMerchant", {-->
			<!--method : "GET",-->
			<!--type : "json",-->
			<!--success : function(result) {-->
				<!--$('#account').append(result.account);-->
				<!--$('#shopName').val(result.shopName);-->
				<!--$('#address').val(result.address);-->
				<!--$('#star').append(result.star);-->
			<!--}-->
		<!--});-->

	<!--}-->
<!--</script>-->

<script>
	angular.module("mainApp",['ngFileUpload'])
			.controller("alterMerchant",['$scope','Upload','$timeout','$http',function($scope,Upload,$timeout,$http){
				$scope.cu={};
				$scope.result=null;

				var req1={
					method:"GET",
					url:"merchant/1"
				};
				$http(req1)
						.then(function(res){
							$scope.m=res.data;
							$scope.cu=$scope.m;
						});




				$scope.uploadFiles=function(file,errFiles){
					$scope.f=file;
					$scope.cu.icon=$scope.f.name;
					$scope.errFiles=errFiles&&errFiles[0];
					if(file){
						file.upload=Upload.upload({
							url:'uploads',
							data:{file:file}
						});

						file.upload.then(function(response){
							$timeout(function(){
								file.result=response.data;
							});
						},function(response){
							if(response.status>0)
								$scope.errorMsg=response.status+':'+response.data;


						},function(evt){
							file.progress=Math.min(100,parseInt(100.0*evt.loaded/evt.total));
						});

					}


				}


				$scope.alert=function(){
					var req={
						method:"PUT",
						url:"merchant",
						data:$scope.cu,
						headers:{"Content-type":"application/json"}
					};

					$http(req)
							.then(function(res){
								if(res.data.account){
									$scope.cu=res.data;
									$scope.m=$scope.cu;
									$scope.result="修改成功";
								}else{
									$scope.result="修改失败";
								}

							});



				}




			}]);


</script>
</html>


